#load "graphics.cma";;
open Graphics;;
open_graph "";;
(*open Random;;*)

let dragon n = 
  clear_graph ();
  let x = 200 in
  let y = 100 in
  let z = 200 in
  let t = 680 in
  let rec dra n (x,y) (z,t) =
    (*set_color (rgb (int 255) (int 255) (int 255));*)
    let u = (x+z)/2 + (t-y)/2 in
    let v = (y+t)/2 - (z-x)/2 in
      if n=0 then
	begin
	  moveto x y;
	  lineto u v;
	  moveto z t;
	  lineto u v;
	  moveto x y;
	  lineto z t;
	end
      else
	begin
	  dra (n-1) (u,v) (x,y);
	  dra (n-1) (u,v) (z,t);
	end
  in
    dra n (x,y) (z,t);;

dragon 25;;
